Matthias Clasen [Sat, 6 Jun 2020 16:59:58 +0000 (12:59 -0400)]
docs: Fix up the GtkNativeDialog section
Without GtkNativeDialog in the section list,
links are not generated from the object hierarchy.
Matthias Clasen [Sat, 6 Jun 2020 17:54:42 +0000 (17:54 +0000)]
Merge branch 'misc-multiselection' into 'master'
Misc multiselection
See merge request GNOME/gtk!2055
Matthias Clasen [Sat, 6 Jun 2020 17:47:05 +0000 (17:47 +0000)]
Merge branch 'list-arrows' into 'master'
listbase: Make up/down arrows work
See merge request GNOME/gtk!2056
Matthias Clasen [Sat, 6 Jun 2020 17:35:05 +0000 (17:35 +0000)]
Merge branch 'property-selection' into 'master'
Property selection
Closes #2826
See merge request GNOME/gtk!2054
Matthias Clasen [Sat, 6 Jun 2020 16:33:12 +0000 (12:33 -0400)]
listbase: Make up/down arrows work
We were missing a binding for up/down without modifiers.
Matthias Clasen [Sat, 6 Jun 2020 15:53:33 +0000 (11:53 -0400)]
singleselection: Clarify docs
Mention persistence and sorting.
Matthias Clasen [Sat, 6 Jun 2020 13:49:25 +0000 (09:49 -0400)]
gtk-demo: Use a property selection in the colors demo
This makes the property persist across sort changes.
Matthias Clasen [Sat, 6 Jun 2020 13:40:04 +0000 (09:40 -0400)]
Add GtkPropertySelection
This is a selection model that stores the selection
state in a boolean property of the items, and thus
persists across reordering and similar changes.
Fixes: #2826
Matthias Clasen [Sat, 6 Jun 2020 15:23:40 +0000 (15:23 +0000)]
Merge branch 'listitemmanager-selection' into 'master'
listitemmanager: Handle selection-changes properly
Closes #2827
See merge request GNOME/gtk!2053
Matthias Clasen [Sat, 6 Jun 2020 15:21:29 +0000 (11:21 -0400)]
multiselection: Rewrite the select_callback implementation
Use a for loop to make this more obvious, and add some
assertions that the callback is behaving properly.
Matthias Clasen [Sat, 6 Jun 2020 15:20:47 +0000 (11:20 -0400)]
Add tests for select_callback
Matthias Clasen [Sat, 6 Jun 2020 15:21:05 +0000 (11:21 -0400)]
Add a forgotten export
gtk_selection_model_unselect_callback needs to be exported.
Matthias Clasen [Sat, 6 Jun 2020 14:36:09 +0000 (10:36 -0400)]
selectionmodel: Document the callback apis
Matthias Clasen [Sat, 6 Jun 2020 14:23:12 +0000 (10:23 -0400)]
Add a test for multiselection persistence
Add a test that verifies that newly added items
are always unselected.
Matthias Clasen [Sat, 6 Jun 2020 14:22:37 +0000 (10:22 -0400)]
multiselection: Clarify docs
Make it clear that GtkMultiSelection is not persistent
across resorting.
Yuri Chornoivan [Sat, 6 Jun 2020 13:46:40 +0000 (13:46 +0000)]
Update Ukrainian translation
Yuri Chornoivan [Sat, 6 Jun 2020 13:44:29 +0000 (13:44 +0000)]
Update Ukrainian translation
Matthias Clasen [Sat, 6 Jun 2020 13:39:36 +0000 (09:39 -0400)]
Drop an unnecessary include
Matthias Clasen [Sat, 6 Jun 2020 12:34:46 +0000 (08:34 -0400)]
listitemmanager: Handle selection-changes properly
The selection model will only emit one of items-changed
or selection-changed, so when we handle an items-changed,
we must assume that selection state may have changed for
any of the newly added items.
This fixes lingering selection state in the visible range
if you change the sorting of the colors demo.
Fixes: #2827
Piotr Drąg [Sat, 6 Jun 2020 12:00:43 +0000 (14:00 +0200)]
Update POTFILES.in and POTFILES.skip
Matthias Clasen [Sat, 6 Jun 2020 05:30:30 +0000 (05:30 +0000)]
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master
See merge request GNOME/gtk!2052
Benjamin Otte [Sat, 6 Jun 2020 05:16:47 +0000 (05:16 +0000)]
Merge branch 'wip/otte/for-master' into 'master'
multiselection: Remove unused code
See merge request GNOME/gtk!2051
Matthias Clasen [Sat, 6 Jun 2020 04:23:04 +0000 (00:23 -0400)]
listitemwidget: Don't look at rubberbanding
Move the selection changes to button release, to
avoid conflict with the drag gesture for rubberbanding.
This avoids peeking at the parent, and is generally
nicer.
Among other things, you can now shift-click to select
a range in the colors demo in gtk4-demo.
Matthias Clasen [Sat, 6 Jun 2020 04:15:50 +0000 (00:15 -0400)]
listbase: Fix an off-by-one error
We were accidentally cutting off the set one-too-early,
which showed up as single clicks not selecting an item
anymore.
Matthias Clasen [Sat, 6 Jun 2020 03:18:00 +0000 (23:18 -0400)]
listbase: Fix a problem with rubberbands
When I changed things to only collect the set
in the stop() function, I overlooked that this
has the side-effect of only handling items which
are backed by a widget at the time stop() is called.
If we make a big rubberband and autoscroll down too
far, we loose the items that go out the visible range
at the top. Fix that by maintaining the set as we go.
Matthias Clasen [Sat, 6 Jun 2020 03:15:20 +0000 (23:15 -0400)]
multiselection: Don't emit nonsensical signals
I forgot to add a check here. We only want to emit
a ::selection-changed if we actually changed it.
Benjamin Otte [Sat, 6 Jun 2020 03:02:37 +0000 (05:02 +0200)]
multiselection: Remove unused code
This is leftover code from an earlier SelectionModel API.
Matthias Clasen [Sat, 6 Jun 2020 01:35:56 +0000 (21:35 -0400)]
NEWS: Updates
Matthias Clasen [Sat, 6 Jun 2020 01:36:27 +0000 (21:36 -0400)]
gtk: Documentation fixups
Document missing symbols, and other cleanups.
Matthias Clasen [Sat, 6 Jun 2020 00:59:51 +0000 (20:59 -0400)]
gdk: Documentation fixups
Document some missing symbols.
Matthias Clasen [Sat, 6 Jun 2020 00:19:45 +0000 (20:19 -0400)]
gsk: Documentation fixups
Document a few missing symbols.
Matthias Clasen [Fri, 5 Jun 2020 23:55:12 +0000 (23:55 +0000)]
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master
See merge request GNOME/gtk!2050
Matthias Clasen [Fri, 5 Jun 2020 23:04:21 +0000 (23:04 +0000)]
Merge branch 'wip/ebassi/a11y-2' into 'master'
Accessibility cleanup
See merge request GNOME/gtk!2049
Matthias Clasen [Fri, 5 Jun 2020 22:12:30 +0000 (18:12 -0400)]
NEWS: Updates
Matthias Clasen [Fri, 5 Jun 2020 22:39:08 +0000 (18:39 -0400)]
gtk-demo: Another way to trigger theme benchmark
The click on the headerbar seems broken atm, so add
an explicit button to trigger the cycling among the
themes.
Matthias Clasen [Fri, 5 Jun 2020 21:21:26 +0000 (17:21 -0400)]
spinbuttonaccessible: Fix an oversight
We need to pass the accessible to the signal handler.
Matthias Clasen [Fri, 5 Jun 2020 21:08:29 +0000 (17:08 -0400)]
Trivial typo fix
Emmanuele Bassi [Fri, 5 Jun 2020 19:31:11 +0000 (20:31 +0100)]
a11y: Drop GtkWidgetAccessibleClass.notify_gtk
It's finally unused.
Accessible types should either watch properties they are interested in
directly, or should have (private) API to allow widgets to update the
accessible state directly.
Emmanuele Bassi [Fri, 5 Jun 2020 19:27:28 +0000 (20:27 +0100)]
a11y: Simplify GtkEntryAccessible
Now that we don't have any additional subclasses of GtkEntryAccessible
in GTK, we can drop all the conditional fluff in the base class.
We still need to subscribe to the global notify signal, because of the
sheer amount of properties watched by GtkEntryAccessible.
Emmanuele Bassi [Fri, 5 Jun 2020 19:15:28 +0000 (20:15 +0100)]
a11y: Implement GtkPasswordEntryAccessible properly
GtkPasswordEntryAccessible is not a GtkEntryAccessible any more, so it
will need a proper implementation of various interfaces and
functionality in order to work like any other entry.
Emmanuele Bassi [Fri, 5 Jun 2020 18:17:31 +0000 (19:17 +0100)]
a11y: Make GtkSearchEntryAccessible a full GtkWidgetAccessible
We should not inherit from GtkEntryAccessible, given that GtkSearchEntry
is *not* a GtkEntry.
Emmanuele Bassi [Fri, 5 Jun 2020 14:52:53 +0000 (15:52 +0100)]
a11y: Simplify GtkScrollbarAccessible
Emmanuele Bassi [Fri, 5 Jun 2020 14:35:38 +0000 (15:35 +0100)]
a11y: Simplify GtkScaleButtonAccessible
Emmanuele Bassi [Fri, 5 Jun 2020 13:35:10 +0000 (14:35 +0100)]
a11y: Simplify GtkSpinButtonAccessible
We're already listening to the adjustment property on the spin button,
there's no need to reset the adjustment on widget set/unset, since the
accessible instance is always tied to the same widget.
Emmanuele Bassi [Fri, 5 Jun 2020 13:15:00 +0000 (14:15 +0100)]
a11y: Simplify GtkTextAccessible
Emmanuele Bassi [Thu, 28 May 2020 14:46:42 +0000 (15:46 +0100)]
a11y: Simplify GtkTextViewAccessible
Drop the GtkWidgetAccessible.notify_gtk override.
Emmanuele Bassi [Thu, 28 May 2020 14:09:02 +0000 (15:09 +0100)]
a11y: Simplify GtkColorSwatchAccessible
Drop the GtkWidgetAccessible.notify_gtk override.
Emmanuele Bassi [Thu, 28 May 2020 13:54:57 +0000 (14:54 +0100)]
a11y: Simplify GtkNotebookAccessible
Let the GtkNotebook explicitly update the accessible object that the
current page has changed, instead of overriding
GtkWidgetAccessible.notify_gtk.
Emmanuele Bassi [Thu, 28 May 2020 13:02:04 +0000 (14:02 +0100)]
a11y: Simplify GtkWindowAccessible
Have GtkWindow notify of title changes, instead of overriding
GtkWidgetAccessible.notify_gtk.
Emmanuele Bassi [Wed, 27 May 2020 19:02:07 +0000 (20:02 +0100)]
a11y: Simplify GtkExpanderAccessible
Drop the GtkWidgetAccessible.notify_gtk and AtkObject.initialize
overrides, and have GtkExpander update the state of the accessible
object directly.
Emmanuele Bassi [Wed, 27 May 2020 18:19:55 +0000 (19:19 +0100)]
a11y: Simplify GtkLevelBarAccessible
Drop the GtkWidgetAccessible.notify_gtk and AtkObject.initialize
overrides, and have GtkLevelBar notify the accessible object of value
changes.
Emmanuele Bassi [Wed, 27 May 2020 16:54:23 +0000 (17:54 +0100)]
a11y: Split GtkSearchEntryAccessible from GtkEntryAccessible
Use a separate accessible object for the GtkSearchEntry, just like we
did for GtkPasswordEntry.
Emmanuele Bassi [Wed, 27 May 2020 15:24:31 +0000 (16:24 +0100)]
a11y: Split password entry accessible from GtkEntryAccessible
Use a separate accessible object.
Emmanuele Bassi [Wed, 27 May 2020 15:04:29 +0000 (16:04 +0100)]
a11y: Simplify GtkProgressBarAccessible
Drop the GtkWidgetAccessibleClass.notify_gtk and the
AtkObjectClass.initialize overrides: they don't do anything relevant.
Instead, have GtkProgressBar update the accessible state when the
fraction changes.
Emmanuele Bassi [Mon, 27 Apr 2020 16:57:27 +0000 (17:57 +0100)]
a11y: Use G_DECLARE macro for GtkWidgetAccessible
Allows us to drop the Private structure typedef.
Emmanuele Bassi [Mon, 27 Apr 2020 16:43:28 +0000 (17:43 +0100)]
a11y: Update the accessible state when GtkIconView:model changes
Do not use a generic "notify" signal handler.
Additionally, clean up the GtkIconViewAccessible implementation to bring
it up with modern idiomatic GObject.
Emmanuele Bassi [Thu, 23 Apr 2020 19:16:31 +0000 (20:16 +0100)]
a11y: Drop notify_gtk() from GtkRangeAccessible
Let the GtkRange notify the accessible instance when the adjustment
changes.
Emmanuele Bassi [Thu, 23 Apr 2020 19:08:18 +0000 (20:08 +0100)]
a11y: Drop notify_gtk() from GtkButtonAccessible
Make GtkButton notify the accessible state directly when updating the
label.
Emmanuele Bassi [Thu, 23 Apr 2020 18:53:37 +0000 (19:53 +0100)]
a11y: Remove GtkToggleButtonAccessible notify_gtk implementation
The base GtkWidgetAccessible class does the right thing by default.
Emmanuele Bassi [Thu, 23 Apr 2020 18:26:49 +0000 (19:26 +0100)]
a11y: Update accessible state for GtkTreeView directly
Do not use GtkWidgetAccessibleClass.notify_gtk().
Emmanuele Bassi [Thu, 23 Apr 2020 17:01:40 +0000 (18:01 +0100)]
Notify accessibility state changes from GtkWidget
Piggybacking on blanket GObject::notify is not very efficient.
Emmanuele Bassi [Thu, 23 Apr 2020 16:48:29 +0000 (17:48 +0100)]
Move orientable style classes into GtkWidget
It feels slightly wrong to have GtkOrientable operate on widgets, but at
least what happens when an orientable widget changes orientation should
be part of GtkWidget.
This will allow to add more state changes without accessing widget state
from the outside of gtkwidget.c.
Emmanuele Bassi [Wed, 22 Apr 2020 19:25:48 +0000 (20:25 +0100)]
Notify mapped state to the accessible object directly
Do not use signal connections: if we have an accessible object, notify
it directly when getting mapped and unmapped.
Emmanuele Bassi [Wed, 22 Apr 2020 19:06:55 +0000 (20:06 +0100)]
Drop unused AtkRegistry path
We expect widgets to use their own derived GtkWidgetAccessible type,
these days, and given that we hard code the default accessible type of a
GtkWidget to GtkWidgetAccessible, and that we enforce the dependency of
the type passed to gtk_widget_class_set_accessible_type(), the registry
code path is clearly unused.
Emmanuele Bassi [Wed, 22 Apr 2020 18:32:17 +0000 (19:32 +0100)]
Make tooltip properties idiomatic
The tooltip handling in GtkWidget is "special":
- the string is stored inside the qdata instead of the private
instance data
- the accessors call g_object_set() and g_object_get(), and the
logic is all inside the property implementation, instead of
being the other way around
- the getters return a copy of the string
- the setters don't really notify all the involved properties
The GtkWidgetAccessible uses the (escaped) tooltip text as a source for
the accessible object description, which means it has to store the
tooltip inside the object qdata, and update its copy at construction and
property notification time.
We can simplify this whole circus by making the tooltip properties (text
and markup) more idiomatic:
- notify all side-effect properties
- return a constant string from the getter
- if tooltip-text is set:
- store the text as is
- escape the markup and store it separately for the markup getter
- if tooltip-markup is set:
- store the markup as is
- parse the markup and store it separately for the text getter
The part of the testtooltips interactive test that checks that the
getters are doing the right thing is now part of the gtk testsuite, so
we ensure we don't regress in behaviour.
Emmanuele Bassi [Mon, 20 Apr 2020 15:47:50 +0000 (16:47 +0100)]
Use modern GObject macros for GtkAccessible
Matthias Clasen [Fri, 5 Jun 2020 19:25:46 +0000 (19:25 +0000)]
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master
See merge request GNOME/gtk!2048
Matthias Clasen [Fri, 5 Jun 2020 17:49:32 +0000 (13:49 -0400)]
multiselection: Fix the select_range implementation
When exclusive is TRUE, we would not always emit a
::selection-changed signal that covers all the items
that were unselected.
This commit includes a test.
Matthias Clasen [Fri, 5 Jun 2020 01:35:53 +0000 (21:35 -0400)]
set: Fix gtk_set_get_max
This function had an off-by-one error. Thankfully,
our selection tests are thorough enough to catch it.
Matthias Clasen [Fri, 5 Jun 2020 18:26:30 +0000 (14:26 -0400)]
dropdown: Connect a forgotten signal handler
The code was exporting a search_stop function, but
the ui file didn't connect it to the ::stop-search
signal. Fix that.
Matthias Clasen [Fri, 5 Jun 2020 18:33:48 +0000 (18:33 +0000)]
Merge branch 'frame-clock-start-time' into 'master'
Tweaks to frame clock for better ties to vsync
See merge request GNOME/gtk!2043
Matthias Clasen [Fri, 5 Jun 2020 18:31:08 +0000 (18:31 +0000)]
Merge branch 'master.msvc' into 'master'
Fix latest GTK master on Visual Studio
See merge request GNOME/gtk!2028
Matthias Clasen [Fri, 5 Jun 2020 18:29:26 +0000 (18:29 +0000)]
Merge branch 'columnview-reorder-cells' into 'master'
Columnview reorder cells
See merge request GNOME/gtk!2047
Matthias Clasen [Fri, 5 Jun 2020 17:59:15 +0000 (17:59 +0000)]
Merge branch 'rubberband-again' into 'master'
Rubberband again
See merge request GNOME/gtk!2041
Matthias Clasen [Fri, 5 Jun 2020 17:49:32 +0000 (13:49 -0400)]
multiselection: Fix the select_range implementation
When exclusive is TRUE, we would not always emit a
::selection-changed signal that covers all the items
that were unselected.
This commit includes a test.
Matthias Clasen [Fri, 5 Jun 2020 01:35:53 +0000 (21:35 -0400)]
set: Add a few useful functions
Allow to find out if a set is empty, and its
min and max.
Matthias Clasen [Fri, 5 Jun 2020 16:40:32 +0000 (12:40 -0400)]
columnview: Update column positions on reordering
Tell reordered columns to reorder their cells to
the new position. This is necessary to get things
like separators right. The visible symptom of this
problem was the lack of the right border when the
last column is reorder to another position, since
the title widget was still the last in its container,
so :last-child applied.
Matthias Clasen [Fri, 5 Jun 2020 16:39:48 +0000 (12:39 -0400)]
columnviewcolumn: Add private api to set the position
This is needed to make columns reorder their cells when
their position in the column views list of columns
changes.
Matthias Clasen [Fri, 5 Jun 2020 16:39:00 +0000 (12:39 -0400)]
listitemwidget: Add api to reorder children
We need this to keep the rows in sync with the columns
when they are reordered.
Matthias Clasen [Fri, 5 Jun 2020 15:34:51 +0000 (11:34 -0400)]
columnviewlayout: Handle for_size propertly
When we are given a for_size as width for the whole
column view, we need to distribute it over the columns
as gtk_column_view_allocate_columns would, in order
to find out which for_size to give to each cell.
This is a bit recursive, but works. Since we are
doing this recursion for every row, we should consider
adding a cache for those distributed widths.
Ray Strode [Fri, 5 Jun 2020 15:58:37 +0000 (15:58 +0000)]
Merge branch 'wip/damaged-but-no-frost-bite' into 'master'
x11: defer _NET_WM_FRAME_DRAWN update until frame usable by compositor
See merge request GNOME/gtk!1982
Matthias Clasen [Fri, 5 Jun 2020 15:38:03 +0000 (15:38 +0000)]
Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Bring back the applauncher demo
See merge request GNOME/gtk!2040
Emmanuele Bassi [Fri, 5 Jun 2020 15:29:41 +0000 (15:29 +0000)]
Merge branch 'ebassi/for-master' into 'master'
Add missing annotation
See merge request GNOME/gtk!2046
Matthias Clasen [Fri, 5 Jun 2020 15:24:55 +0000 (11:24 -0400)]
columnview: Split gtk_column_view_allocate_columns
Split off a helper function that just distributes
the widths, without actually allocating the columns.
This will be used in measuring in the future.
Matthias Clasen [Fri, 5 Jun 2020 13:37:59 +0000 (09:37 -0400)]
columnview: Take column width into account for measuring
When measuring the height of a cell, we need to give
it it the width of its column, if we expect realistic
results.
Ray Strode [Wed, 27 May 2020 19:12:35 +0000 (15:12 -0400)]
x11: Defer _NET_WM_FRAME_DRAWN update until frame usable by compositor
With the vendor provided Nvidia driver there is a small window of time
after drawing to a GL surface before the updates to that surface
can be used by the compositor.
Drawing is already coordinated with the compositor through the frame
synchronization protocol detailed here:
https://fishsoup.net/misc/wm-spec-synchronization.html
Unfortunately, at the moment, GdkX11Surface tells the compositor the
frame is ready immediately after drawing to the surface, not later,
when it's consumable by the compositor.
This commit defers announcing the frame as ready until it's consumable
by the compositor. It does this by listening for the X server to announce
damage events associated with the frame drawing. It tries to find the
right damage event by waiting until fence placed at buffer swap time
signals.
Ray Strode [Tue, 2 Jun 2020 20:29:03 +0000 (16:29 -0400)]
x11: Factor out some of frame sync code into subroutines
This commit moves some of the end frame sync counter handling
code to subroutines.
It's a minor readability win, but the main motivation is to
make it easier in a subsequent commit to defer updating the
sync counter until a more appropriate time.
Ray Strode [Wed, 27 May 2020 18:53:10 +0000 (14:53 -0400)]
x11: Add back support for the damage extension
commit
14bf58ec5dfdf19e3ca603b977626608dafc729b dropped support
for using the DAMAGE extension since there was no code that
needed it.
We're going to need it again, however, to address an NVidia
vendor driver issue.
This commit does the plumbing to add it back.
Timm Bäder [Fri, 5 Jun 2020 04:26:56 +0000 (06:26 +0200)]
filechooserwidget: Avoid an uninitialised value
For NULL filters, we were never calling g_list_store_find, so leaving
filter_index undefined.
Timm Bäder [Fri, 5 Jun 2020 04:26:25 +0000 (06:26 +0200)]
demos: Avoid shadowing a global from time.h
Sad but true.
Timm Bäder [Fri, 5 Jun 2020 04:19:34 +0000 (06:19 +0200)]
filterlistmodel: Fix fallthrough annotations in unreachable code
They are only unreachable in debug builds but still break the build on
clang.
Matthias Clasen [Fri, 5 Jun 2020 13:37:21 +0000 (09:37 -0400)]
columview: Make cells propagate request mode
I think this is necessary to make wrapping
labels work.
Matthias Clasen [Fri, 5 Jun 2020 13:35:56 +0000 (09:35 -0400)]
gtk-demo: Improve wrapping in settings demo
The columnview overrides the width of its content,
so if a label is not willing to wrap its content
below a certain width, it will just get cut off.
Avoid that by not setting width-chars on the wrapping
content.
Emmanuele Bassi [Fri, 5 Jun 2020 13:33:17 +0000 (14:33 +0100)]
Add missing annotation
Matthias Clasen [Fri, 5 Jun 2020 12:44:23 +0000 (08:44 -0400)]
columviewlayout: Skip children when we should
Every layout manager should call gtk_widget_should_layout
on their children before measuring or allocating them.
So do it here too.
Matthias Clasen [Fri, 5 Jun 2020 00:11:35 +0000 (20:11 -0400)]
listview: Add an example to the docs
The example is an excerpt from the applauncher
demo in gtk4-demo.
Matthias Clasen [Thu, 4 Jun 2020 19:44:39 +0000 (15:44 -0400)]
gtk-demo: Bring back the applauncher demo
Just without the coverflow. It was a well-documented
demo, so it is useful to keep around.
Yariv Barkan [Sat, 30 May 2020 21:23:24 +0000 (00:23 +0300)]
frame clock: schedule in refresh intervals
When the application does not receive "frame drawn" signals we schedule
the clock to run more or less at intervals equal to the last known
refresh interval. In order to minimize clock skew we have to aim for
exact intervals.
Alexander Larsson [Fri, 5 Jun 2020 09:30:47 +0000 (11:30 +0200)]
frame clock: Better handle non-regular clock cycles
We try to step the frame clock in whole refresh_interval steps, but to
avoid drift and rounding issues we additionally try to converge it to
be synced to the physical vblank (actually the time we get the
frame-drawn message from the compositor, but these are tied together).
However, the convergence to vsync only really makes sense if the new
frame_time actually is tied to the vsync. It may very well be that
some other kind of event (say a network or mouse event) triggered
the redraw, and not a vsync presentation.
We used to assume that all frames that are close in time (< 4 frames
apart) were regular and thus tied to the vsync, but there is really no
guarantee of that. Even non regular times could be rapid.
This commit changes the code to only do the convergence-to-real-time
if the cause of the clock cycle was a thaw (i.e. last frame drawn and
animating). Paint cycles for any other kind of reason are always
scheduled an integer number of frames after the last cycle that was
caused by a thaw.
Alexander Larsson [Fri, 5 Jun 2020 09:16:57 +0000 (11:16 +0200)]
frame clock: Track if paint is caused by thaw or not
When we get to a paint cycle we now know if this was caused by a
thaw, which typically means last frame was drawn, or some other event.
In the first case the time of the cycle is tied to the vblank in some
sense, and in the others it is essentially random. We can use this
information to compute better frame times. (Will be done in later
commits.)